layui.use(['layer', 'miniTab','echarts'], function () {
    var $ = layui.jquery,
        layer = layui.layer;
    //用户统计
    $("#user-count").on('click','.no-margins',function(re){
        let id_arr=$(re.currentTarget).next().html();

        let index = layer.open({
            title: '用户统计',
            type: 2,
            shade: 0.2,
            maxmin: true,
            shadeClose: true,
            area: ['100%', '100%'],
            content: '/admin/member/index?id_arr='+id_arr,
        });
        $(window).on("resize", function () {
            layer.full(index);
        });
    })
    //供应商统计
    $("#supplier-count").on('click','.no-margins',function(re){
        let index = layer.open({
            title: '供应商入住',
            type: 2,
            shade: 0.2,
            maxmin: true,
            shadeClose: true,
            area: ['100%', '100%'],
            content: '/admin/Supplier/index?audit_status=1&from_client=2',
        });
        $(window).on("resize", function () {
            layer.full(index);
        });
    })
    //订单统计
    $("#order-count").on('click','.no-margins',function(re){
        let id_arr=$(re.currentTarget).next().html();

        let index = layer.open({
            title: '订单统计',
            type: 2,
            shade: 0.2,
            maxmin: true,
            shadeClose: true,
            area: ['100%', '100%'],
            content: '/admin/OrderData/index?id_arr='+id_arr,
        });
        $(window).on("resize", function () {
            layer.full(index);
        });
    })

    $("#order-count").on('click','.no-marginss',function(re){
        let id_arr=$(re.currentTarget).next().html();

        let index = layer.open({
            title: '订单操作',
            type: 2,
            shade: 0.2,
            maxmin: true,
            shadeClose: true,
            area: ['100%', '100%'],
            content: '/admin/Order/ActionIndex',
        });
        $(window).on("resize", function () {
            layer.full(index);
        });
    })

    //销售统计
    $("#saleorder-count").on('click','.no-margins',function(re){
        let id_arr=$(re.currentTarget).next().html();

        let index = layer.open({
            title: '销售统计',
            type: 2,
            shade: 0.2,
            maxmin: true,
            shadeClose: true,
            area: ['100%', '100%'],
            content: '/admin/SaleOrderData/index?id_arr='+id_arr,
        });
        $(window).on("resize", function () {
            layer.full(index);
        });
    })

    //注册排行
    $("#reg-count").on('click',function(re){

        let index = layer.open({
            title: '注册排行',
            type: 2,
            shade: 0.2,
            maxmin: true,
            shadeClose: true,
            area: ['50%', '80%'],
            content: '/admin/Datacenter/UserRegList?id_arr=',
        });
        $(window).on("resize", function () {
            layer.full(index);
        });
    })
    /**
     * 查看公告信息
     **/
    $('body').on('click', '.layuimini-notice', function () {
        var title = $(this).children('.layuimini-notice-title').text(),
            noticeTime = $(this).children('.layuimini-notice-extra').text(),
            content = $(this).children('.layuimini-notice-content').html();
        var html = '<div style="padding:15px 20px; text-align:justify; line-height: 22px;border-bottom:1px solid #e2e2e2;background-color: #2f4056;color: #ffffff">\n' +
            '<div style="text-align: center;margin-bottom: 20px;font-weight: bold;border-bottom:1px solid #718fb5;padding-bottom: 5px"><h4 class="text-danger">' + title + '</h4></div>\n' +
            '<div style="font-size: 12px">' + content + '</div>\n' +
            '</div>\n';
        parent.layer.open({
            type: 1,
            title: '系统公告'+'<span style="float: right;right: 1px;font-size: 12px;color: #b1b3b9;margin-top: 1px">'+noticeTime+'</span>',
            area: '300px;',
            shade: 0.8,
            id: 'layuimini-notice',
            btn: ['查看', '取消'],
            btnAlign: 'c',
            moveType: 1,
            content:html,
            success: function (layero) {
                var btn = layero.find('.layui-layer-btn');
                btn.find('.layui-layer-btn0').attr({
                    href: 'https://gitee.com/zhongshaofa/layuimini',
                    target: '_blank'
                });
            }
        });
    });



});